import Vue from 'vue'
import Router from 'vue-router'
import lgRouters from "./lg";
import wchRouters from "./wch";
import ylqRouters from "./ylq";
import zrmRouters from "./zrm";
import HelloWorld from '@/components/HelloWorld'


Vue.use(Router)

// export default new Router({
//   routes: [
//     ...testRouters,
//     {
//       path: '/HelloWorld',
//       name: 'HelloWorld',
//       component: HelloWorld
//     }
//   ]
// })

const router = new Router({
  // mode: routerMode, // history模式需要服务端支持
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) { //如果savedPosition存在，滚动条会自动跳到记录的值的地方
      return savedPosition
    } else {
      return { x: 0, y: 0 } //savedPosition也是一个记录x轴和y轴位置的对象
    }
  },
  routes: [
    ...ylqRouters,
    ...zrmRouters,
    ...wchRouters,
    ...lgRouters,
    {
      path: '/HelloWorld',
      name: 'HelloWorld',
      component: HelloWorld
    }
  ]
})

export default router
